package xin.zhiyin.控制.验证码;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import xin.zhiyin.工具.captcha.HappyCaptcha;
import xin.zhiyin.工具.captcha.common.Fonts;
import xin.zhiyin.工具.captcha.support.CaptchaStyle;
import xin.zhiyin.工具.captcha.support.CaptchaType;

@Controller
public class HappyCaptchaController {
    @RequestMapping("/captcha")
    public void happyCaptcha(HttpServletRequest request, HttpServletResponse response){
        HappyCaptcha.require(request,response)
                .style(CaptchaStyle.ANIM)  /*验证码风格*/
                .type(CaptchaType.ARITHMETIC) /*验证码类型*/
                .length(5)  /*验证码字符长度*/
                .width(160)  /*验证码图片的宽度*/
                .height(60)  /*验证码图片的高度*/
                .font(Fonts.getInstance().defaultFont())  /*验证码的字体*/
                .build().finish();
    }
}
